using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TreeSharp;

namespace FelMaster.Classes.Paladin
{
    class PaladinProt : TalentBase
    {
        public override string Name
        {
            get { return "Prot Paladin 1.3"; }
        }

        public override string KeySpell
        {
            get { return "Avenger's Shield"; }
        }
        
        public override Composite SingleRotation
        {
            get {
               return new PrioritySelector(
                    new Decorator(x => SC.PlayerIsChanneling, new TreeSharp.Action(a => SC.Log("Channeling"))),
                    SC.UseEngineerGloves(a => true, "Engineer's glove enchant"),
                    SC.CastBuff("Seal of Truth", a => Me.CurrentMana > 20000, "Seal of Truth"),
                    SC.CastBuff("Seal of Insight", a => Me.CurrentMana < 7000, "Seal of Insight for Mana Gen"),
                    SC.CastBuff("Seal of Truth", a => !SC.PlayerHasBuff("Seal of Truth") && !SC.PlayerHasBuff("Seal of Insight"), "Seal of Truth"),
                    SC.CastSpell("Judgement", a => SC.PlayerHasBuff("Seal of Insight") && !SC.PlayerHasBuff("Judgements of the Wise"), "Judgement"),
                    SC.CastSpell("Word of Glory", a => Me.CurrentHolyPower == 3 && Me.HealthPercent < 25, "Word of Glory+++"),
                    SC.CastSpell("Word of Glory", a => Me.CurrentHolyPower == 2 && Me.HealthPercent < 15, "Word of Glory++"),
                    SC.CastSpell("Word of Glory", a => Me.CurrentHolyPower == 1 && Me.HealthPercent < 5, "Word of Glory+"),
                    SC.CastSpell("Shield of the Righteous", a => Me.CurrentHolyPower >= 3 && SC.PlayerHasBuff("Inquisition"), "Shield of the Righteous"),
                    SC.CastSpell("Shield of the Righteous", a => Me.CurrentHolyPower >= 3 && SC.PlayerHasBuff("Sacred Duty"),"Shield of the Righteous"),
                    SC.CastSpell("Inquisition", a => Me.CurrentHolyPower >= 3, "Inquisition"),
                    SC.CastBuff("Avenging Wrath", a => SC.PlayerHasBuff("Inquisition"), "Wings with Inquisition"),
                    SC.CastAreaSpell("Hammer of the Righteous", 8, false, 2, 0.0, 0.0, ret => true, "Hammer of the Righteous"),
                    SC.CastSpell("Avenger's Shield", a => SC.PlayerHasBuff("Grand Crusader"), "Avengers Shield Proc"),
                    SC.CastSpell("Crusader Strike", a => true, "Crusader Strike"),
                    SC.CastSpell("Judgement", a => SC.PlayerHasBuff("Seal of Insight"), "Judgement"),
                    SC.CastSpell("Avenger's Shield", a => true, "Avengers Shield"),
                    SC.CastAreaSpell("Judgement", 8, false, 3, 0.0, 0.0, ret => true, "Judgement"),
                    SC.CastAreaSpell("Consecration", 8, false, 3, 0.0, 0.0, ret => Me.CurrentMana > 12000, "Consecration"),
                    SC.CastAreaSpell("Holy Wrath", 8, false, 3, 0.0, 0.0, ret => true, "Holy Wrath"),
                    SC.CastSpell("Hammer of Wrath", a => true, "Hammer of Wrath"),
                    SC.CastSpell("Judgement", a => true, "Judgement"),
                    SC.CastBuff("Divine Plea", a => Me.CurrentMana < 17000, "Divine Plea"),
                    SC.CastSpell("Consecration", a => Me.CurrentMana > 17000, "Consecration"),
                    SC.CastSpell("Holy Wrath", a => true, "Holy Wrath")
                );
            }
        }

        public override Composite Buffs
        {
            get
            {
                return new PrioritySelector(
                    SC.CastBuff("Righteous Fury", a => true, "Righteous Fury"),
                    SC.CastBuff("Blessing of Kings", a => !SC.PlayerHasBuff("Mark of the Wild"), "Blessing of Kings as I don't have druid buff"),
                    SC.CastBuff("Blessing of Might", a => SC.PlayerHasBuff("Mark of the Wild"), "Blessing of Might as I have druid buff")
                );
            }
        }

        public override Composite PVPRotation
        {
            get { throw new NotImplementedException(); }
        }

        public override Composite PVERotation
        {
            get
            {
                return SingleRotation;
            }
        }
    }
}